/*
 Copyright 2009 Abdulla Abdurakhmanov (abdulla@latestbit.com)
 Original sources are available at www.latestbit.com

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.

 StdMasterKeyConnectionAuthenticator.hpp. Created on: 05.10.2009 15:31:50 
 */

#ifndef STDMASTERKEYCONNECTIONAUTHENTICATOR_HPP_
#define STDMASTERKEYCONNECTIONAUTHENTICATOR_HPP_

#include "smartobjects/SmartObjectsDefs.hpp"
#include "IConnectionAuthenticator.hpp"

namespace smartobjects {

class StdMasterKeyConnectionAuthenticator : public IConnectionAuthenticator {
public:
	SO_DLLPRFX StdMasterKeyConnectionAuthenticator();
	SO_DLLPRFX StdMasterKeyConnectionAuthenticator(const std::string& sMasterKey);
	SO_DLLPRFX virtual ~StdMasterKeyConnectionAuthenticator();

	SO_DLLPRFX virtual void encodeCredentials (
		IHandshakeManager* poManager,
		IDataTypesCoder* poCoder,
		ByteBuffer* poWriteBuffer);

	SO_DLLPRFX virtual void decodeCredentials (
		IHandshakeManager* poManager,
		IDataTypesCoder* poCoder,
		ByteBuffer* poReadBuffer );

	SO_DLLPRFX virtual const std::string& getMasterKey() const;
	SO_DLLPRFX virtual void setMasterKey(const std::string& );

protected:
	std::string m_sMasterKey;

};

}

#endif /* STDMASTERKEYCONNECTIONAUTHENTICATOR_HPP_ */
